<template>
  <!-- 列表 -->
  <ContentWrap>
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
      <el-table-column label="宗地序号" align="center" prop="id">
        <template #default="scope">
          <el-link type="primary" @click="openLandForm('update', scope.row.id)">{{
            scope.row.id
          }}</el-link>
        </template>
      </el-table-column>
      <el-table-column label="宗地编号" align="center" prop="landNo" />
      <el-table-column label="土地证号" align="center" prop="landCertificate" />
      <el-table-column label="宗地坐落" align="center" prop="landLocation" />
      <!-- <el-table-column label="所属区县" align="center" prop="landDistrict" />
      <el-table-column label="所属乡镇" align="center" prop="landTownship" />
      <el-table-column label="所属村" align="center" prop="landVillage" /> -->
      <el-table-column label="面积" align="center" prop="landArea" />
      <el-table-column label="征收标准（元/平方米*年）" align="center" prop="levyStandards" />
      <el-table-column label="权利性质" align="center" prop="landQlxz" />
      <el-table-column label="批准用途" align="center" prop="landApprovedUse" />
      <el-table-column label="实际用途" align="center" prop="landActualUse" />
      <el-table-column label="土地级别" align="center" prop="landLevel" />
      <el-table-column label="不动产单元号" align="center" prop="landBdcdyh" />
      <!-- <el-table-column label="坐标" align="center" prop="landCoordinate" /> -->
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="状态" align="center" prop="status">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.SYS_STATUS" :value="scope.row.status" />
        </template>
      </el-table-column>
    </el-table>
  </ContentWrap>

  <LandForm ref="landFormRef" @success="getList" />
</template>
<script setup lang="ts">
import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import { RentApi } from '@/api/zszx/rent'

import LandForm from '@/views/zszx/land/LandForm.vue'
const landFormRef = ref()
const openLandForm = (type: string, id?: number) => {
  landFormRef.value.open(type, id)
}

const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗

const props = defineProps<{
  landIds?: string // 宗地序号（主表的关联字段）
}>()
const loading = ref(false) // 列表的加载中
const list = ref([]) // 列表的数据

/** 查询列表 */
const getList = async () => {
  loading.value = true
  try {
    list.value = await RentApi.getLandListByLandIds(props.landIds)
  } finally {
    loading.value = false
  }
}

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.pageNo = 1
  getList()
}

/** 初始化 **/
onMounted(() => {
  getList()
})
</script>
